<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<style>.total_hide { display:none; }</style>

<div class="row">
	<div class="col-xs-12">
		<div class="btn-group m-b-1" role="group">
			<?php echo admin_tab_active($menu['other']['tab'], 'trash');?>
		</div>
	</div>
</div>

<div class="row">
	<form action="<?php echo url('other-trash');?>" method="POST" id="form">
		<div class="col-md-3 m-b-sm">
			<select class="form-control" name="type">
				<option value="order">订单数据</option>
				<option value="order_cash">提现数据</option>
			</select>
		</div>
		<div class="col-md-3 m-b-sm">
			<input class="form-control" value="<?php echo date('Y-m-d', $time-86400*7);?>" name="fdate" placeholder="开始时间">
		</div>
		<div class="col-md-3 m-b-sm">
			<input class="form-control" value="<?php echo date('Y-m-d', $time);?>" name="tdate" placeholder="结束时间">
		</div>
		<div class="col-md-1 m-b-sm">
			<input type="password" class="form-control" id="passcode" name="passcode" value="" placeholder="安全码">
		</div>
		<div class="col-md-1 m-b-sm">
			<button id="submit" class="form-control btn btn-primary">清理</button>
		</div>
	</form>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>

var jform = $('#form');
var jsubmit = $('#submit');
jform.on('submit', function() {
  	if(confirm('确认清理吗？')){
      jform.reset();
      jsubmit.button('loading');
      var postdata = jform.serialize();
      $.xpost(jform.attr('action'), postdata, function(code, message) {
          if(code == 0) {
              $.alert(message);
              jsubmit.text(message).delay(3000).button('reset');
          } else if(code < 0) {
              $.alert(message);
              jsubmit.button('reset');
          } else {
              alert(message);
              jform.find('[name="'+code+'"]').alert(message).focus();
              jsubmit.button('reset');
          }
      });
    }
	return false;
});

$('#nav_pc li.other, #nav_mobile li.other').tab('show');
</script>